#include <iostream>

using namespace std;


int main(){
    int n;
    cin >> n;
   
    int arr[110]{};

    int cnt = 0;
    
    while(true){
        arr[cnt] = n;
        if (n % 2 == 0){
            n = n/2;
        }else{
            n = n*3+1;
        }
        if (n == 1){
            arr[cnt] = 1;
            cnt++;
            break;
        }
        cnt++;
    }

    for(int i=cnt-1;i>=0;i--){
        cout << arr[i] << " ";
    }


    return 0;
}